home *** CD-ROM | disk | FTP | other *** search
/ Plug-In Power Pack for Netscape Communicator / Plug-In Power Pack for Netscape Communicator.iso / plugins / dataviews / include / vutextarray.h < prev   
C/C++ Source or Header  |  1997-05-08  |  6KB  |  156 lines

  1. /*
  2. |    file name -- VUtextarray.h
  3. |====================================================================
  4. |
  5. |    copyright (c) 1990, V.I. corporation
  6. |
  7. |    VUtextarray - Types, macros, and defines for using VUtextarray
  8. |
  9. |    charlie goldensher     6 Feb 90
  10. |    M.Krasnik           3 Jan 91  Add cursor style enum.
  11. |    M.Krasnik          19 Feb 91  Add area type enum.
  12. |    M.Krasnik          19 Feb 91  Get rid of NULL_ENUM.
  13. |                                  Textronics compiler does not support
  14. |                                  enums with members of the same name.
  15. |====================================================================
  16. */
  17. #ifndef    VUTEXTARRAY_H
  18. #define    VUTEXTARRAY_H
  19. #include "std.h"
  20.  
  21.  
  22. /********************** Common Data Structures *********************/
  23.  
  24. /* Character position within a text array */
  25. typedef struct TA_POSITION
  26.   { short row, col; } TA_POSITION;
  27.  
  28. /* Rectangular region within a text array */
  29. typedef struct TA_RECT
  30.   { TA_POSITION ul, lr; } TA_RECT;
  31.  
  32. /* Foreground and background colors packed together */
  33. typedef    UBYTE    TA_PACKED_COLOR;
  34.  
  35. /* The public text array data structure */
  36. typedef    ADDRESS    TEXTARRAY;
  37.  
  38.  
  39. /************** Macros for processing a TA_POSITION **************/
  40.  
  41. /* Assign (new) values to a TA_POSITION.
  42. |  Returns that TA_POSITION. */
  43. #define    V_TPSET(tp,r,c)       ( (tp)->row = (r), (tp)->col = (c), (tp) )
  44.  
  45. /* Add the given values to a TA_POSITION.  Returns that TA_POSITION. */
  46. #define    V_TPADD(tp,r,c)       ( (tp)->row += (r), (tp)->col += (c), (tp) )
  47.  
  48. /* Copy values of one TA_POSITION to another.  Return dest TA_POSITION */
  49. #define    V_TPCOPY(dst,src)    ( (dst)->row = (src)->row, \
  50.                   (dst)->col = (src)->col, (dst) )
  51.  
  52.  
  53. /**************** Macros for processing a TA_RECT ****************/
  54.  
  55. /* Assign (new) values to a TA_RECT.  Returns that TA_RECT. */
  56. #define    V_TRSET(tr,ulrow,ulcol,lrrow,lrcol)    \
  57.            ( (tr)->ul.row = (ulrow), (tr)->ul.col = (ulcol),\
  58.              (tr)->lr.row = (lrrow), (tr)->lr.col = (lrcol),\
  59.              (tr) )
  60.  
  61. /* Add the given values to a TA_RECT.  Returns that TA_RECT. */
  62. #define    V_TRADD(tr,ulrow,ulcol,lrrow,lrcol)    \
  63.            ( (tr)->ul.row += (ulrow), (tr)->ul.col += (ulcol),\
  64.              (tr)->lr.row += (lrrow), (tr)->lr.col += (lrcol),\
  65.              (tr) )
  66.  
  67. /* Copy values of one TA_RECT to another.  Return dest TA_RECT */
  68. #define    V_TRCOPY(dst,src)  ( (dst)->ul.row = (src)->ul.row,    \
  69.                  (dst)->ul.col = (src)->ul.col,    \
  70.                  (dst)->lr.row = (src)->lr.row,    \
  71.                  (dst)->lr.col = (src)->lr.col,    \
  72.                  (dst) )
  73.  
  74. /* Returns width of TA_RECT. */
  75. #define    V_TRWIDTH(tr)       ( (tr)->lr.col - (tr)->ul.col + 1 )
  76.  
  77. /* Returns height of a TA_RECT */
  78. #define    V_TRHEIGHT(tr)       ( (tr)->lr.row - (tr)->ul.row + 1 )
  79.  
  80.  
  81. /*** Macros for packing and unpacking character color attributes ***/
  82.  
  83. #define V_PACK_COLOR(fore,back)    ((((fore) & 0xf)<<4)|((back) & 0xf))
  84. #define V_UNPACK_COLOR( color, fore, back ) \
  85.                ( (fore) = (color)>>4 & 0xf,        \
  86.                  (back) = (color)    & 0xf,        \
  87.                  (color) )
  88.  
  89.  
  90. /********************** Text Array Constants ***********************/
  91.  
  92. /* Number of colors available for text array */
  93. #define V_TA_NUM_COLORS 16
  94.  
  95. /* prepacked text colors */
  96. #define    V_TA_NORMAL    0x10    /* color[1] on color[0] */
  97. #define    V_TA_INVERSE    0x01    /* color[0] on color[1] */
  98.  
  99.  
  100. /* Bit-flag definitions for spec_flag passed to VUtaCreate().
  101. |  These flags are (bitwise) or'd together and used as spec flag.) */
  102.  
  103. /* Orientation Point:  where anchor point is to be fixed */
  104. #define    V_OP_BITS    0x0F    /* bits defining orientation point */
  105. #define    V_OP_TOP    0x01            /* top */
  106. #define    V_OP_BOTTOM    0x02            /* bottom */
  107. #define    V_OP_LEFT    0x04            /* left */
  108. #define    V_OP_RIGHT    0x08            /* right */
  109. #define    V_OP_LL        (V_OP_BOTTOM|V_OP_LEFT)    /* lower left */
  110. #define    V_OP_LR        (V_OP_BOTTOM|V_OP_RIGHT)/* lower right */
  111. #define    V_OP_UL        (V_OP_TOP|V_OP_LEFT)    /* upper left */
  112. #define    V_OP_UR        (V_OP_TOP|V_OP_RIGHT)    /* upper right */
  113. #define    V_OP_CENTERED    0x00            /* centered */
  114.  
  115. /* Resolution of conflicts betw scr (szscr) and char (szchr) size. */
  116. #define    V_RSLVE_BITS       0x30    /* all resolution bits */
  117. #define    V_RSLVE_X_GREATER  0x10    /* greater of two in x dir */
  118. #define    V_RSLVE_Y_GREATER  0x20    /* greater of two in y dir */
  119. #define    V_RSLVE_X_LESSER   0x00    /* lesser of two in x dir */
  120. #define    V_RSLVE_Y_LESSER   0x00    /* lesser of two in y dir */
  121. #define    V_RSLVE_GREATER       (V_RSLVE_X_GREATER|V_RSLVE_Y_GREATER)/* > */
  122. #define    V_RSLVE_LESSER       (V_RSLVE_X_LESSER|V_RSLVE_Y_LESSER)  /* < */
  123.  
  124. /* What to do with slop */
  125. #define    V_SLOP_BITS    0x3C0    /* what to do with slop */
  126. #define    V_SLOP_X_SHRINK    0x040    /* shrink: discard slop in the x-dir */
  127. #define    V_SLOP_Y_SHRINK    0x080    /* shrink: discard slop in the y-dir */
  128. #define    V_SLOP_X_LEAVE    0x000    /* leave slop alone in the x-dir */
  129. #define    V_SLOP_Y_LEAVE    0x000    /* leave slop alone in the y-dir */
  130. #define    V_SLOP_X_EXPAND    0x100    /* expand: include slop in the x-dir */
  131. #define    V_SLOP_Y_EXPAND    0x200    /* expand: include slop in the y-dir */
  132. #define    V_SLOP_SHRINK    (V_SLOP_X_SHRINK|V_SLOP_Y_SHRINK)/* shrink */
  133. #define    V_SLOP_LEAVE    (V_SLOP_X_LEAVE|V_SLOP_Y_LEAVE)     /* leave */
  134. #define    V_SLOP_EXPAND    (V_SLOP_X_EXPAND|V_SLOP_Y_EXPAND)/* expand */
  135.  
  136. /* Cursor styles */
  137. typedef enum 
  138. {
  139.    V_UTA_UNDERSCORE=1,
  140.    V_UTA_REVERSE,
  141.    V_UTA_COLOR
  142. } V_UTA_CURSOR_ENUM;
  143.  
  144. typedef enum 
  145. {
  146.    V_UTA_RECTANGLE=1,
  147.    V_UTA_AREA
  148. } V_UTA_AREA_ENUM;
  149.  
  150. #endif    /* VUTEXTARRAY_H */
  151.  
  152.  
  153.  
  154.  
  155.  
  156.